import numpy as np
from numpy import dot
from numpy import mat
X=mat([1,2,3]).reshape(3,1)
Y=2*X
theta=1
alpha=0.1
for i in range(100):
    theta=theta+np.sum(alpha*(Y-dot(X,theta))*X.reshape(1,3))/3.
print(theta)